/**
 * node层的http服务
 * 负责调用后端接口，聚合接口数据，以及其他数据转换，提供给页面友好的数据返回
 */
const testController = require('../api/controller/testController');
const express = require('express');
const router = express.Router();

module.exports = router;

router.get('/list', function (req, res, next) {
  res.send({
    code: 0,
    success: true,
    data: [{
      id: 1,
      name: 'zhangsan'
    },{
      id: 2,
      name: 'lisi'
    },{
      id: 3,
      name: 'wangwu'
    }]
  });
});

router.get('/test', function (req, res, next) {
  testController.test().then(result => {
    res.send(result);
  }).catch(err => {
    res.send(err);
  });
});
